from django.conf.urls import url
from django.views.static import serve

from apps.category import views
from apps.upload import upload_image
from personal_blog import settings

urlpatterns = [
    url(r'^category/(?P<num>\d+)/$', views.CategoryView.as_view(), name="category"),
    url(r'^article/(?P<id>\d+)/$', views.ArticleDetailView.as_view(), name="article_detail"),
    url(r'^edit/$', views.EditView.as_view(), name="edit"),
    url(r'^personal/$', views.PersonalArticle.as_view(), name="personal"),
    url(r'^alter/$', views.Alter.as_view(), name="alter"),
    url(r'^delete/$', views.Delete.as_view(), name="delete"),

    url('^admin/upload/(?P<dir_name>[^/]+)$', upload_image, name='upload_image'),
    url("^uploads/(?P<path>.*)$", serve,
        {"document_root": settings.MEDIA_ROOT, }),

]
